package com.shitou.shitoumember.utils;

import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.StringJoiner;

/**
 * class detail:
 *
 * @author 石头人
 */
@SuppressWarnings("all")
public class Test {
    public static void main(String[] args) throws IOException {
        String projuctPath = System.getProperty("user.dir");
        // 文件路径
        File file = new File(projuctPath + "\\shitou-member\\src\\main\\resources\\static\\mytext\\test.txt");
        if ( file.exists() ){
            file.delete();
        }
        // 随机读写文件
        RandomAccessFile raf = new RandomAccessFile(file,"rw");
        // 指定指针为开始位置
        raf.seek(0);
        for ( int i = 113 ; i <= 1115 ; i ++){
            StringJoiner joiner = new StringJoiner("");
            joiner.add(String.valueOf(i));
            raf.seek(raf.length());
            raf.write(joiner.toString().getBytes());
            raf.write("\r\n".getBytes());
        }

    }
}
